package com.example.boot.service.impl;

import com.example.boot.bean.Account;
import com.example.boot.mapper.AccountMapper;
import com.example.boot.service.AccountService;
import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author shkstart
 * @creat 2021-04-07-上午10:14
 */
@Service
public class AccountServiceImpl implements AccountService {
    @Autowired
    AccountMapper accountMapper;

    Counter counter;

    public AccountServiceImpl(MeterRegistry meterRegistry){
        counter = meterRegistry.counter("cityService.saveCity.count");

    }

    public Account getAccByid(Long id){
        //记数，每被调用一次加1
        counter.increment();
        return  accountMapper.getAcct(id);
    }
}
